package com.andkrup.easygame.data {

	/**
	 * @author Andkrup
	 */
	public class Player {
		public var objects:Array;
		public var completedMaps:Array;
		public var stats:Array;
		public var career:Career;
		public var score:int;
		
		public function Player(){
			objects = [];
			completedMaps = [];
			stats = [];
		}
		
		public function addStat(playerStat:PlayerStat):void{
			if(!containsStat(playerStat)){
				stats.push(playerStat);
			}
		}
		public function containsStat(playerStat:PlayerStat):Boolean{
			var l:uint = stats.length;
			for(var i:uint = 0; i < l; i++){
				if((stats as PlayerStat).name==playerStat.name){
					return true;
				}
			}
			return false;
		}
		public function removeStat(playerStat:PlayerStat):void{
			var l:uint = stats.length;
			for(var i:uint = 0; i < l; i++){
				if((stats as PlayerStat).name==playerStat.name){
					stats.splice(i, 1);
					break;
				}
			}
		}
	}
}
